import axios from 'axios';
// dev开发 test测试 prod生产
let env = 'prod';
let baseUrl = '';
if (env === 'dev') {
  baseUrl = '待配置';
} else if (env === 'test') {
  baseUrl = '待配置';
} else {
  baseUrl = 'http://huruqing.cn:3002/api';
}


const get =(url,data) => {
  url = baseUrl + url;
  return new Promise((resolve,reject)=> {
    axios.get(url,{params:data}).then(res=> {
      if (res.data.code == '666') {
        resolve(res.data);
      } else {
        alert(res.data.msg);
      }
    }).catch(error=> {
      console.log('错误信息',error);
    })
  })
}

export default {
  get
}